package cn.yiufung.qxquartz.service;

import cn.yiufung.qxquartz.entity.SystemScheduledDO;
import cn.yiufung.qxquartz.exception.TaskException;
import com.baomidou.mybatisplus.extension.service.IService;
import org.quartz.SchedulerException;

/**
 * @author 姚锋
 * @createTime 2023年08月18日 10:57:00
 */
public interface SystemScheduledService extends IService<SystemScheduledDO> {

    /**
     * 暂停定时任务
     * @param id SystemScheduledDO表ID
     * @throws SchedulerException
     * @throws TaskException
     */
    void pauseJob(Long id) throws SchedulerException, TaskException;

    /**
     * 继续任务
     * @param id SystemScheduledDO表ID
     * @throws SchedulerException
     * @throws TaskException
     */
    void resumeJob(Long id) throws SchedulerException, TaskException;

    /**
     * 删除任务
     * @param id SystemScheduledDO表ID
     * @throws SchedulerException
     * @throws TaskException
     */
    void deleteJob(Long id) throws SchedulerException, TaskException;

    /**
     * 单独执行一次任务
     * @param id
     * @throws SchedulerException
     */
    void run(Long id) throws SchedulerException;

    /**
     * 新增任务
     * @param systemScheduledDO
     * @throws SchedulerException
     * @throws TaskException
     */
    void addScheduled(SystemScheduledDO systemScheduledDO) throws SchedulerException, TaskException;

    /**
     * 修改任务
     * @param systemScheduledDO
     * @throws SchedulerException
     * @throws TaskException
     */
    void updateScheduled(SystemScheduledDO systemScheduledDO) throws SchedulerException, TaskException;

}
